<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>知识荟</title>
    <link rel="stylesheet" href="../css/main.css" />
    <script type="text/javascript" src="../js/jquery.js"></script>
    <script type="text/javascript" src="../js/top.js"></script>
    <script type="text/javascript" src="../js/main.js"></script>

<body>
<!--**************顶部导航****************-->
<%@include file="../jsp/common/nav.jsp"%>
<!--**********************************************--->
<div class="bottom">
    <!--标题导航-->
    <div class="bottom-nav">
        <span class="nav-title-bottom"><h2>学习空间</h2></span>
    </div>
    <!--选择-->
    <div class="tab">
        <!--推荐空间-->
        <div>
            <input type="radio" id="r-1" name="tab" checked>
            <label for="r-1" class="label-1">推荐空间</label>
            <div class="mod-1">
                <c:set var="user" value="${sessionScope.user}"/>
                <div class="top">
                    <ul>
                        <c:forEach var="space" items="${spaceList}">
                            <li>
                                <div class="item">
                                    <div class="item-left">
                                        <span class="item-title"><a href="/space/spacename?userId=${space.userId}&space_id=${space.id}&id=${user.id}">${space.name}</a></span>
                                        <span class="item-writer"><a href="/space/spacemember?userId=${space.userId}&name=${space.name}">${space.user.username}</a></span>
                                    </div>
                                    <div class="content">
                                        <span class="item-content">${space.detail}</span>
                                    </div>
                                    <div class="item-right">
                                        <span class="time"><fmt:formatDate value="${space.createdate}" pattern='yyyy年MM月dd日 HH:mm:ss'/></span>
                                    </div>
                                </div>
                            </li>
                        </c:forEach>
                    </ul>
                </div>
            </div>
            <!--查看空间-->
            <div>
                <input type="radio" id="r-2" name="tab">
                <label for="r-2" class="label-2">查看空间</label>
                <div class="mod-2">
                    <div class="top">
                        <ul>
                            <c:forEach var="space" items="${spaceList}">
                                <li>
                                    <div class="item">
                                        <div class="item-left">
                                            <span class="item-title"><a href="/space/spacename?userId=${space.userId}&space_id=${space.id}&id=${user.id}">${space.name}</a></span>
                                            <span class="item-writer"><a href="/space/spacemember?userId=${space.userId}&name=${space.name}">${space.user.username}</a></span>
                                        </div>
                                        <div class="content">
                                            <span class="item-content">${space.detail}</span>
                                        </div>
                                        <div class="item-right">
                                            <span class="time"><fmt:formatDate value="${space.createdate}" pattern='yyyy年MM月dd日 HH:mm:ss'/></span>
                                        </div>
                                    </div>
                                </li>
                            </c:forEach>
                        </ul>
                    </div>
                </div>
            </div>
            <!--收藏空间-->
            <div>
                <input type="radio" id="r-3" name="tab">
                <label for="r-3" class="label-3">收藏空间</label>
                <div class="mod-3">
                    <div class="top">
                        <ul>
                            <c:forEach var="spaceUser" items="${spaceUser}">
                                <li>
                                    <div class="item">
                                        <div class="item-left">
                                            <span class="item-title"><a href="/space/spacename?userId=${spaceUser.userId}&space_id=${spaceUser.id}&id=${user.id}">${spaceUser.name}</a></span>
                                            <span class="item-writer"><a href="/space/spacemember?userId=${spaceUser.userId}&name=${spaceUser.name}">${spaceUser.user.username}</a></span>
                                        </div>
                                        <div class="content">
                                            <span class="item-content">${spaceUser.detail}</span>
                                        </div>
                                        <div class="item-right">
                                            <span class="time"><fmt:formatDate value="${spaceUser.createdate}" pattern='yyyy年MM月dd日 HH:mm:ss'/></span>
                                        </div>
                                    </div>
                                </li>
                            </c:forEach>
                        </ul>
                    </div>
                </div>
            </div>
            <!--我的空间-->
            <div>
                <input type="radio" id="r-4" name="tab">
                <label for="r-4" class="label-4">我的空间</label>
                <div class="mod-4">
                    <div class="top">
                        <ul>
                            <c:forEach var="spaceUser" items="${spaceUser}">
                                <li>
                                    <div class="item">
                                        <div class="item-left">
                                            <span class="item-title"><a href="/space/spacename?userId=${spaceUser.userId}&space_id=${spaceUser.id}&id=${user.id}">${spaceUser.name}</a></span>
                                            <span class="item-writer"><a href="/space/spacemember?userId=${spaceUser.userId}&name=${spaceUser.name}">${spaceUser.user.username}</a></span>
                                        </div>
                                        <div class="content">
                                            <span class="item-content">${spaceUser.detail}</span>
                                        </div>
                                        <div class="item-right">
                                            <span class="time"><fmt:formatDate value="${spaceUser.createdate}" pattern='yyyy年MM月dd日 HH:mm:ss'/></span>
                                        </div>
                                    </div>
                                </li>
                            </c:forEach>
                        </ul>
                    </div>
                </div>
            </div>
            <div id="button" >
                <form action="#">
                    <input type="button" value="加入空间" onclick="location.href='space-joinspace'"/>
                </form>
                <form>
                    <select onchange="self.location.href=options[selectedIndex].value">
                        <option value="#" hidden>最新时间</option>
                        <option value="${pageContext.request.contextPath}/space/spacePaixu1?userId=${user.id}">最新时间</option>
                        <option value="${pageContext.request.contextPath}/space/spacePaixu2?userId=${user.id}">最新创建</option>
                        <option value="${pageContext.request.contextPath}/space/spacePaixu2?userId=${user.id}">最新收藏</option>
                    </select>
                </form>
                <form action="#">
                    <input type="button" value="新建学习空间" onclick="location.href='space-new-space'"/>
                </form>
            </div>
        </div>
    </div>
</div>
<!--***************分页****************-->
<div class="page">
    <ul>
        <li class="page_li">
            <a class="page_btn"id="prePage" href="${pageContext.request.contextPath}/index/main?page=${currentPage-1}">
                <
            </a>
        </li>
        <li class="page_li">
            <a class="page_btn" id="page_btn1" href="${pageContext.request.contextPath}/index/main?page=1">
                1
            </a>
        </li>
        <li class="page_li"> <span class="pages_span" id="prePoint">...</span> </li>
        <li class="page_li">
            <a class="page_btn" id="page_btn2" href="${pageContext.request.contextPath}/index/main?page=${currentPage-2}">
                ${currentPage-2}
            </a>
        </li>
        <li class="page_li">
            <a class="page_btn" id="page_btn3" href="${pageContext.request.contextPath}/index/main?page=${currentPage-1}">
                ${currentPage-1}
            </a>
        </li>
        <li class="page_li">
            <a class="page_btn" id="page_btn4" href="${pageContext.request.contextPath}/index/main?page=${currentPage}">
                ${currentPage}
            </a>
        </li>
        <li class="page_li">
            <a class="page_btn" id="page_btn5" href="${pageContext.request.contextPath}/index/main?page=${currentPage+1}">
                ${currentPage+1}
            </a>
        </li>
        <li class="page_li">
            <a class="page_btn" id="page_btn6" href="${pageContext.request.contextPath}/index/main?page=${currentPage+2}">
                ${currentPage+2}
            </a>
        </li>
        <li class="page_li"> <span class="pages_span" id="sufPoint">...</span> </li>
        <li class="page_li">
            <a class="page_btn" id="page_btn7" href="${pageContext.request.contextPath}/index/main?page=${pageTotal}">
                ${pageTotal}
            </a>
        </li>
        <li class="page_li">
            <a class="page_btn" id="sufPage" href="${pageContext.request.contextPath}/index/main?page=${currentPage+1}">
                >
            </a>
        </li>
    </ul>
</div>
</body>
</html>
